package com.xzx.shop_front_api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xzx.shop_front_api.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * goods mapper
 */
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {
    //库存处理
    @Update("update shop_goods set stock=stock-${buyQuantity},lock_stock=lock_stock-${buyQuantity} where id=${goodsId}")
    int updateGoodsStock(Integer goodsId, @Param("buyQuantity") Integer buyQuantity);
}
